﻿using Prism.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using 基于WPF的电缆采样数据分析系统.MsgEvents;
using 基于WPF的电缆采样数据分析系统.MsgEvents.AccountingReport;
using 基于WPF的电缆采样数据分析系统.Views.TDRWork.MenuPage;

namespace 基于WPF的电缆采样数据分析系统.Views
{
    /// <summary>
    /// AccountingReportUC.xaml 的交互逻辑
    /// </summary>
    public partial class AccountingReportUC : UserControl
    {

        /// <summary>
        /// 发布订阅
        /// </summary>
        private readonly IEventAggregator Aggregator;

        public AccountingReportUC()
        {
            InitializeComponent();

            Aggregator = App.GetService<IEventAggregator>();
            Aggregator.GetEvent<MsgFormSelectTheColumnsToDisplay>().Subscribe(SelectTheColumnsToDisplay);
        }

        /// <summary>
        /// 操作日志全选
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WorkLogCheck_Checked(object sender, RoutedEventArgs e)
        {

        }

        /// <summary>
        /// 操作日志不全选
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WorkLogCheck_Unchecked(object sender, RoutedEventArgs e)
        {

        }


        /// <summary>
        /// 最近使用文件全选
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RecentUsedFileCheck_Checked(object sender, RoutedEventArgs e)
        {

        }

        /// <summary>
        /// 最近使用文件不全选
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RecentUsedFileCheck_Unchecked(object sender, RoutedEventArgs e)
        {

        }

        /// <summary>
        /// 切换查询页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToggleGraphic(object sender, SelectionChangedEventArgs e)
        {
            int selectedIndex = ToggleBox.SelectedIndex;


            if (ChannelAndRefWav != null &&
                RecentUsedFile != null &&
                WorkLog != null)
            {
                switch (selectedIndex)
                {
                    case 0:
                        ChannelAndRefWav.Visibility = Visibility.Visible;
                        RecentUsedFile.Visibility = Visibility.Collapsed;
                        WorkLog.Visibility = Visibility.Collapsed;
                        RecentUsedFileQuery.Visibility = Visibility.Collapsed;
                        WorkLogQuery.Visibility = Visibility.Collapsed;
                        break;
                    case 1:
                        ChannelAndRefWav.Visibility = Visibility.Collapsed;
                        RecentUsedFile.Visibility = Visibility.Visible;
                        WorkLog.Visibility = Visibility.Collapsed;
                        RecentUsedFileQuery.Visibility = Visibility.Visible;
                        WorkLogQuery.Visibility = Visibility.Collapsed;
                        break;
                    case 2:
                        ChannelAndRefWav.Visibility = Visibility.Collapsed;
                        RecentUsedFile.Visibility = Visibility.Collapsed;
                        WorkLog.Visibility = Visibility.Visible;
                        RecentUsedFileQuery.Visibility = Visibility.Collapsed;
                        WorkLogQuery.Visibility = Visibility.Visible;
                        break;
                }
            }
            
        }


        /// <summary>
        /// 选择列显示
        /// </summary>
        private void SelectTheColumnsToDisplay(int column)
        {
            switch (column)
            {
                case 0:
                    Aid.Visibility = Visibility.Visible;
                    break;
                case 1:
                    Aid.Visibility = Visibility.Hidden;
                    break;
                case 2:
                    Uid.Visibility = Visibility.Visible;
                    break;
                case 3:
                    Uid.Visibility = Visibility.Hidden;
                    break;
                case 4:
                    Time.Visibility = Visibility.Visible;
                    break;
                case 5:
                    Time.Visibility = Visibility.Hidden;
                    break;
                case 6:
                    OperateDescription.Visibility = Visibility.Visible;
                    break;
                case 7:
                    OperateDescription.Visibility = Visibility.Hidden;
                    break;

            }
        }
    }
}
